package serviceset3

class Order {

    long sn = new Date().time

    String customer

    static hasMany = [goods: String]

    Date datePaid
    Date dateCreated

    static constraints = {
        sn(blank: false, unique: true, display: false)
        customer(blank: false)
        goods(nullable: false, minSize: 1)
        datePaid(nullable: true, validator: { it < new Date() })
        dateCreated()
    }

    static mapping = {
        table "pay_order"
    }
}
